Skip to content

feat(pgpm): semantic-diff inverses via @pgsql/scripts node-level API - #1567

Merged
pyramation merged 3 commits into
mainfrom
feat/semantic-diff-node-inverses
Jul 31, 2026
Merged

feat(pgpm): semantic-diff inverses via @pgsql/scripts node-level API#1567
pyramation merged 3 commits into
mainfrom
feat/semantic-diff-node-inverses

Conversation

@pyramation

@pyramation pyramation commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Summary

semantic-diff-driver.ts now composes revert/verify at the AST level via the node API published in @pgsql/scripts@18.1.0 (pgsql-parser#328), instead of round-tripping through deparsed text:

// per statement, reverse topo order:
const nodes = invertStatement(fact);        // AnyNode[] | null (null = not derivable)
if (nodes === null) {
  // fall back to revertFor([fact]) only to surface the
  // "-- revert not derivable: <reason>" comment + warning
} else {
  pieces.push(...nodes.map(deparseStmt));   // deparse once
}

const checks = existenceCheck(fact);        // SelectStmt nodes | null

Prior-state inversion (DROP COLUMN re-add, ALTER TYPE back, etc.) stays in the semantic differ via swapped-side diffs — @pgsql/scripts remains strictly "invertible from the deploy alone".

Now depends on the published @pgsql/scripts@^18.1.0 and pgsql-deparser@18.2.0 (the temporary .tarballs/ and pnpm override used during development have been removed).

Tests: pgpm/transform 60/60, pgpm/export granularity e2e 10/10 against the published packages.

Refs constructive-planning#1329 (Phase 4 follow-up).

Link to Devin session: https://app.devin.ai/sessions/7f032c8e1bf245eeac2def99fdcc1623
Requested by: @pyramation

…via @pgsql/scripts node API

Tarball-pinned @pgsql/scripts + pgsql-deparser for testing ahead of publish
(see .tarballs/); DO NOT MERGE until the tarball deps are replaced with
published versions.
@pyramation pyramation self-assigned this Jul 31, 2026
@devin-ai-integration

Copy link
Copy Markdown
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

@devin-ai-integration devin-ai-integration Bot changed the title DO NOT MERGE (tarball dep): semantic-diff inverses via @pgsql/scripts node-level API feat(pgpm): semantic-diff inverses via @pgsql/scripts node-level API Jul 31, 2026
@devin-ai-integration
devin-ai-integration Bot marked this pull request as ready for review July 31, 2026 16:51
@pyramation
pyramation merged commit 117303b into main Jul 31, 2026
16 checks passed
@pyramation
pyramation deleted the feat/semantic-diff-node-inverses branch July 31, 2026 21:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant